1. Technical Field
The present invention is directed to data processing systems. More specifically, the present invention is directed to a method, apparatus, and computer program product for utilizing a self-tuning parameter to dynamically determine when to yield a processor that is assigned to perform particular work but that is currently idle.
2. Description of Related Art
A symmetric multiprocessing (SMP) data processing system has multiple processors that are symmetric such that each processor has the same processing speed and latency. An SMP system has one operating system that divides the work into tasks that are distributed evenly among the various processors by dispatching one software thread of work to each processor at a time. Thus, a processor in an SMP system executes only one thread at a time.
A simultaneous multi-threading (SMT) data processing system includes multiple processors that can each concurrently execute more than one thread at a time per processor. An SMT system has the ability to favor one thread over another when both threads are running on the same processor. If one SMT thread is idle, the performance of other SMT threads that are executing on the same core can be improved by having the idle SMT thread yield its portion of its processor's resources.
Known systems can include a shared processor where the shared processor is shared among the various processes that are being executed by the system. A shared processor may be part of a logically partitioned system and shared among the various partitions in the system. These systems typically include firmware, also called a hypervisor, that manages and enforces the partitioning and/or sharing of the processor. For example, a hypervisor may receive a request from the system to dispatch a virtual processor to a physical processor. The virtual processor includes a definition of the work to be done by a physical processor as well as various settings and state information that are required to be set within the physical processor in order for the physical processor to execute the work.
In known systems there exists a pool of one or more available physical processors. When in the pool, these processors are available and currently unassigned. The pool is managed by a process or firmware such as a hypervisor. Any time work is needed to be performed, a request will be received by the hypervisor to dispatch a particular virtual processor that defines the work. The hypervisor then selects a physical processor from the pool to use to perform this work to which the virtual processor will be dispatched. When the physical processor is selected, it is logically removed from the pool and temporarily assigned to perform the work defined by the virtual processor. This temporary assignment is done when a particular virtual processor is dispatched by the hypervisor to a particular physical processor.
When a virtual processor is dispatched to a physical processor, the physical processor is assigned to that virtual processor for a preset period of time. The physical processor is assigned for that period of time regardless of the amount of time that may be needed to complete the work defined by the virtual processor. Thus, when the physical processor finishes the work defined by the virtual processor before the preset period of time expires, the physical processor will not have any useful work to do but will remain assigned to that virtual processor. In this case, the physical processor will be idle until the time period ends, i.e. it is not performing any useful work until the time period ends. When the time period ends, the physical processor is released from this temporary assignment and is again logically included in the pool of available processors.
Another example of a processor waiting for work is when a process being executed by the processor is spinning, waiting to acquire a software lock. Software locks are known in the art. Locks are typically used to serialize access to some shared resource. Thus, prior to a thread accessing a shared resource, it is required that the thread acquire a particular software lock. After a thread acquires the lock, that thread holds the lock as long as it requires access to the shared resource. Other threads desiring to access the same resource must wait until the thread finishes its work and releases the lock. When the lock is released, it is available. Waiting or spinning threads may again contend for the lock. Thus, when a process is spinning, the processor that is executing the process is not able to perform other useful work.
It is known in the art to be able to yield an idle processor. When a processor is yielded, it becomes available to be assigned to do other work. When it is yielded, it becomes part of the pool of available processors.
Therefore, a need exists for a method, apparatus, and computer program product for providing a selftuning parameter that is used to dynamically determine when to yield a processor that is assigned to perform particular work but that is currently idle.